import {router} from './index'
import {getToken} from '../utils/auth'
const whiteList=['/login']
// 鉴权
router.beforeEach(async(to,from,next)=>{
    // jwt
    const hasToken=getToken();
    // console.log(to,from,'-------')
    if(hasToken){
        // 
    }else{
        // 鉴权白名单中
        if(whiteList.indexOf(to.path)!==-1){
            next()
        }else{
            next('/login')
        }
        // 不需要权限的 直接
        // login
    }
    next('/article');
})